/* 
 * Copyright (c) 2012, Fromentin Xavier, Schnell Michaël, Dervin Cyrielle, Brabant Quentin
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *      * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *      * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *      * The names of its contributors may not be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL Fromentin Xavier, Schnell Michaël, Dervin Cyrielle OR Brabant Quentin 
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package kameleon.plugin;

import kameleon.document.Document;
import kameleon.exception.KameleonException;

/**
 * Superclass for all analyzer plug-ins.
 * 
 * <p>All plug-in analyzers must extend this class (directly or not) and 
 * implement its methods to be usable by the software.
 * 
 * <p>The task of an analyzer is to convert a document contained in a given file and
 * in a known format into an instance of {@code Document}. This task is achieved by
 * calling the method {@code analyze}.
 * 
 * @author		Schnell Michaël
 * @version		1.0
 */
public abstract class Analyzer extends PlugIn {
	
	/**
	 * Sole constructor.
	 */
	protected Analyzer() {
		super() ;
	}// Analyzer()
	
	/**
	 * Analyzes the document contained in the given file and returns an instance of {@code Document}
	 * with the analyzed content of the file.
	 * 
	 * <p>Different options can be given to the analyzer using the {@code options} parameter.
	 * 
	 * <p>It is possible for an analyzer to return an instance of a subclass of {@code Document} or to use
	 * a subclass of {@code SupportedOptions}, though is should be avoided, as other plug-ins are unlikely
	 * to be able to use any added features.
	 * 
	 * @param 	filePath
	 * 			absolute path of the analyzed file
	 * 
	 * @param	options
	 * 			analyzer options
	 * 
	 * @return	Instance of {@code Document} containing the analyzed content of the given file
	 * 
	 * @throws 	KameleonException
	 * 			if an error occured while analyzing the file
	 * 
	 * @see		SupportedOptions
	 */
	public abstract Document analyze(String filePath, SupportedOptions options) throws KameleonException ;
	
	/**
	 * Analyzes the document contained in the given file and returns an instance of {@code Document}
	 * with the analyzed content of the file using default options.
	 * 
	 * @param 	filePath
	 * 			absolute path the analyzed file
	 * 
	 * @return	Instance of {@code Document} containing the analyzed content of the given file
	 * 
	 * @throws 	KameleonException
	 * 			if an error occured while analyzing the file
	 * 
	 * @see		#analyze(String, SupportedOptions)
	 */
	public abstract Document analyze(String filePath) throws KameleonException ;

}// class Analyzer